<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
//$list = pdo_getall('wyzc_sun_type',array('uniacid' => $_W['uniacid']),array(),'','num ASC');
//$info = pdo_getall('yzzc_sun_branch',array('uniacid'=>$_W['uniacid']));
$where="where uniacid =".$_W['uniacid'];
if($_GPC['keywords']){
    $op=$_GPC['keywords'];
    $where.=" and name LIKE  '%$op%' or mobile like '%$op%'";
}
if($_GPC['type']=='wait'){
    $where .=" and status =1";
}elseif ($_GPC['type']=='ok'){
    $where .=" and status =2";
}
$page = max(1, intval($_GPC['page']));
$size = intval($_GPC['psize']) ? intval($_GPC['psize']) : 10;
$sql = 'SELECT * FROM '.tablename('yzzc_sun_store_order')."{$where} ORDER BY store_id DESC LIMIT ".(($page-1) * $size).','.$size;

$info = pdo_fetchall($sql);
array_walk($info,function (&$v){
    $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
    $v['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
});
$total=pdo_fetchcolumn("select count(*) from " . tablename("yzzc_sun_store") .$where);
$pager = pagination($total, $page, $size);
include $this->template('web/store/store_order');